<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>粘滞定位</title>

    <style>
        .top{
            height: 60px;
            background-color: blueviolet;
            font-size: 28px;
            color: #000;
            text-align: center;
            line-height: 60px;
        }
        .nav{
            width: 100%;
            height: 68px;
            background-color: brown;
            color: chartreuse;
            text-align: center;
            line-height: 60px;
            position: sticky;
            top: 0;
        }
    </style>
</head>
<body>
    <div class="top">top</div>
    <div class="nav">nav</div>
    <div style="height: 1000px;"></div>
</body>
</html>